package com.homework.ch04;

import java.util.Arrays;

public class Test02 {
    public static void main(String[] args) {
        //有数组String[] arr = new String[]{"hello","world","!"};请使用2种不同的方式进行遍历
        String[] arr=new String[]{"hello","world","!"};
        //for循环遍历
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i]+" ");
        }
        System.out.println();
        //while循环遍历
        int i=0;
        while(i<arr.length)
        {
            System.out.print(arr[i]+" ");
            i++;
        }
        System.out.println();
        //for循环增强版
        for (String value:arr) {
            System.out.print(value+" ");
        }

    }
}
